<?php
$eventpropertyStr = Yii::t('BWeSport', 'Event Property');
$detailcontentStr = Yii::t('BWeSport', 'Detail Content');
$eventtypeStr = Yii::t('BWeSport', 'Event Type');
$eventnameStr = Yii::t('BWeSport', 'Event Name');
$eventimageStr = Yii::t('BWeSport', 'Event Image');
$eventstarttimeStr = Yii::t('BWeSport', 'Event Start Time');
$eventendtimeStr = Yii::t('BWeSport', 'Event End Time');
$eventprofileStr = Yii::t('BWeSport', 'Event Profile');
$starttimeStr = Yii::t('BWeSport', 'Start Time');
$endtimeStr = Yii::t('BWeSport', 'End Time');

$eventTypeField = 'eventType_eventTypeId';
$eventNameField = 'event_name';
$eventDescriptionField = 'event_description';
$model->addField($eventNameField);
$model->addField($eventDescriptionField);
$model->addField($eventTypeField);

if ($eventId > 0) {
    $event = new BWEvent($eventId);
    $eventType = $event->getType();
    if ($eventType)
        $model->$eventTypeField = $eventType->getId();
    if($event->name)
        $model->$eventNameField = $event->name;
    if(!$event->description)
        $model->$eventDescriptionField = $event->description;
}
?>
<?php
$app = Blyn::app()->getActiveApp();
$typeList = $app->getEventTypeList('FullName');
//$newTypeList = array();
foreach ($typeList as $id => $typeName) {
    $typeName = Yii::t('BWeSport', $typeName);
    $typeList[$id] = $typeName;
}
$list = array('0' => '请选择');
$typeList = $list + $typeList;
?>

<table class="table table-hover">
    <colgroup>
        <col class="span1">
        <col class="span7">
    </colgroup>
    <thead>
        <tr>
            <th><?php echo $eventpropertyStr; ?></th>
            <th><?php echo $detailcontentStr; ?></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <?php echo  '<nobr style="color: red;font-size:20px">*</nobr>'.$eventtypeStr; ?>
            </td>
            <td>
                <?php
                echo $form->dropDownList($model, $eventTypeField, $typeList, array('class' => 'span7'));
                ?>
                <!--                    &nbsp;&nbsp;&nbsp;&nbsp;<a id="CreateNewType_clink" role="button" data-toggle="modal" class="btn disabled" style="font-size: 12px;margin-top: -12px;">创建新类型</a>-->
            </td>
        </tr>
        <tr><td> <?php echo '<nobr style="color: red;font-size:20px">*</nobr>'.$eventnameStr; ?> </td>
            <td>
                
                <?php   
                
                echo $form->textField($model, $eventNameField, array('placeholder' => $eventnameStr . '...', 'required' => true));
               // echo 
                ?>
            </td>
           
        </tr>               
        <tr>
            <td> <?php echo $eventprofileStr; ?>  </td>                    
            <td>
                <?php
                echo $form->textArea($model, $eventDescriptionField, array('placeholder' => $eventprofileStr . '...'));
                ?>
        </tr>
    </tbody>
</table>